<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/userwelcome' }"
        >首页</el-breadcrumb-item
      >
      <el-breadcrumb-item>会员卡管理</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片 -->
    <el-card>
      <!-- 标题 -->
      <div slot="header" class="clearfix">
        <span>我的卡片与服务</span>
      </div>
      <!-- 标题下一行 -->
      <el-row class="title">
        <!-- 文字 -->
        <el-col span="20"
          ><div class="title-text">
            共有 {{ queryInfo.pageAll }}项，正在展示第 {{ queryInfo.pageNum }}到
            {{ queryInfo.pageAll }}项
          </div></el-col
        >
        <!-- 搜索框 -->
        <el-col :span="4">
          <el-input
            placeholder="请输入内容"
            v-model="queryInfo.query"
            clearable
          >
            <el-button slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </el-col>
      </el-row>
      <!-- 表格 -->
      <el-table :data="CardData" border style="width: 100%">
        <el-table-column
          prop="cardId"
          label="卡片编号"
          width="180"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="cardName"
          label="卡片名称"
          width="380"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="cardTypeName"
          label="卡片类型"
          align="left"
          width="200"
        >
        </el-table-column>
        <el-table-column prop="cardComment" label="卡片详情" align="left">
        </el-table-column>
        <el-table-column label="操作" align="left">
          <el-button @click="cardManage">管理卡片</el-button>
        </el-table-column>
      </el-table>

      <!-- 分页功能 -->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[1, 2, 5, 10]"
        :page-size="1"
        layout="total, sizes, prev, pager, next, jumper"
        :total="30"
      >
      </el-pagination>
      <!-- 弹出框 -->
      <el-dialog
        title="管理卡片"
        :visible.sync="setManageCardDialog"
        width="30%"
        :close-on-click-modal="false"
      >
        <span>这是一段信息</span>
  
      </el-dialog>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "VipCard",
  data() {
    return {
      // 搜索框数据
      queryInfo: {
        query: "",
        pageNum: 3,
        pageAll: 10,
      },
      //控制dialog打开和关闭
      setManageCardDialog: false,
      //el-img的内容
       fits: ['fill', 'contain', 'cover', 'none', 'scale-down'],
    
      // 表格数据
      CardData: [
        {
          cardId: "C101",
          cardName: "益丰大药房会员卡",
          cardTypeName: "会员卡",
          cardComment: "吃的",
          cardpicture: require("assets/img/cardPack/apple.png"),
        },
        {
          cardId: "C102",
          cardName: "麦当劳会员卡",
          cardTypeName: "会员卡",
          cardComment: "吃的",
          cardpicture: require("assets/img/cardPack/apple.png"),
        },
        {
          cardId: "C103",
          cardName: "蛙知道会员卡",
          cardTypeName: "会员卡",
          cardComment: "吃的",
          cardpicture: require("assets/img/cardPack/apple.png"),
        },
        {
          cardId: "C104",
          cardName: "中信优惠+会员卡",
          cardTypeName: "会员卡",
          cardComment: "用的",
          cardpicture: require("assets/img/cardPack/apple.png"),
        },
        {
          cardId: "C104",
          cardName: "中信优惠+会员卡",
          cardTypeName: "会员卡",
          cardComment: "用的",
          cardpicture: require("assets/img/cardPack/apple.png"),
        },
        {
          cardId: "C104",
          cardName: "中信优惠+会员卡",
          cardTypeName: "会员卡",
          cardComment: "用的",
          cardpicture: require("assets/img/cardPack/apple.png"),
        },
        {
          cardId: "C104",
          cardName: "中信优惠+会员卡",
          cardTypeName: "会员卡",
          cardComment: "用的",
          cardpicture: require("assets/img/cardPack/apple.png"),
        },
        {
          cardId: "C104",
          cardName: "中信优惠+会员卡",
          cardTypeName: "会员卡",
          cardComment: "用的",
          cardpicture: require("assets/img/cardPack/apple.png"),
        },
      ],
      // 当前页数
      currentPage: 4,
    };
  },
  methods: {
    // 分页的操作
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    // 点击管理卡片的事件
    cardManage() {
      // el-dialog打开
      this.setManageCardDialog = true;
    },
  },
};
</script>

<style lang="less" scoped>
.title {
  margin-bottom: 10px;
  .title-text {
    line-height: 30px;
  }
}
.el-table {
  margin-bottom: 10px;
}
</style>